package com.stylefeng.guns.rest.modular.example;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.stylefeng.guns.rest.common.SimpleObject;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * 常规控制器
 *
 * @author fengshuonan
 * @date 2017-08-23 16:02
 */
@RestController
@RequestMapping("/simple")
public class ExampleController {
	
	//文档生成参照：http://blog.csdn.net/saytime/article/details/74937664

	// http://127.0.0.1:8081/simple/simpleObject
	@ApiOperation(value="获取simpleObject详细信息", notes="根据提交的参数返回simpleObject详细信息")
	@ApiImplicitParam(name = "name", value = "名字", required = true, dataType = "String")
    @RequestMapping("/simpleObject")
    public ResponseEntity<?> simpleObject(SimpleObject simpleObject) {
    		Map<String,Object> map = new HashMap<>();
    		map.put("simpleObject", simpleObject);
    		
    		List<Map<String,Object>> list = new ArrayList<>();
    		list.add(map);
    		
        System.out.println("========================="+simpleObject.getUser());
        return new ResponseEntity(list,HttpStatus.OK);
        //return ResponseEntity.ok(list);
    }
    
    
    
    
    
    
    
    //==
}
